﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.TeamFoundation.VersionControl.Client;

namespace TFhisto
{
    public abstract class BaseListItem
    {
        public abstract DateTime Date
        {
            get;
        }
    }

    public class HistoryItem : BaseListItem
    {
        Changeset m_changeset;
        Change m_change;

        public HistoryItem(Changeset changeset, Change change)
        {
            m_changeset = changeset;
            m_change = change;
        }

        public Changeset Changeset
        {
            get { return m_changeset; }
            set { m_changeset = value; }
        }

        public Change Change
        {
            get { return m_change; }
            set { m_change = value; }
        }

        public override DateTime Date
        {
            get { return Changeset.CreationDate; }
        }

        public string Branch
        {
            get { return CommonUIHelper.ConvertBranch(Change.Item.ServerItem); }
        }
    }

    public class LabelItem : BaseListItem
    {
        VersionControlLabel m_label;

        public LabelItem(VersionControlLabel label)
        {
            m_label = label;
        }

        public VersionControlLabel Label
        {
            get { return m_label; }
            set { m_label = value; }
        }

        public override DateTime Date
        {
            get { return Label.LastModifiedDate; }
        }


    }
}
